﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using MINERP.DAL;
using MINERP.COM;
using MINERP.DAL.Statistics;

namespace MINERP.BLL.Statistics
{
    public class ComPerfBLL
    {
        ComPerfDAL  dal=new ComPerfDAL();
        public DataTable GetAllPerf(DateTime inStartTime,DateTime inEndTime)
        {
            string strSQL = "select sum(aCount) as aCount, sum(bCount) as bCount from (                 " +
                            "select   case  when ProductName like '%冲印%' then sum(Count)  else 0 end as aCount       " +
                            ",case  when  ProductName  like   '%冲印%' then 0 else  sum(Count) end as bCount        " +
                            " from                                                                      " +
                            "orderInfo_BK,Tb_Product,Bill_Detail,Bill_Detail_Detail                     " +
                            "where orderInfo_BK.ProductId=Tb_Product.ProuctId                           " +
                            "and orderInfo_BK.OrderProductCode=Bill_Detail.OrderInfoCode                " +
                            "and Bill_Detail.BillDetailId=Bill_Detail_Detail.BillDetailId               " +
                            "and orderInfo_BK.CompleteTime between convert(datetime,'" + inStartTime + "') and  convert(datetime,'" + inEndTime + "')                                " +
                            "group by ProductName                                                       " +
                            ") as t                                                                     ";
            return dal.ExceSQL(strSQL);
        }
        
    }
}
